home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Source Code
/
Visual Basic Source Code.iso
/
vbsource
/
asocia1a
/
frmmain.frm
(
.txt
)
< prev
next >
Wrap
Visual Basic Form
|
1999-10-22
|
4KB
|
133 lines
VERSION 5.00
Begin VB.Form frmMain
Caption = "Associate Wizard"
ClientHeight = 2025
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
Icon = "frmMain.frx":0000
LinkTopic = "Form1"
ScaleHeight = 2025
ScaleWidth = 4680
StartUpPosition = 2 'CenterScreen
Begin VB.TextBox txtFile
Height = 330
Left = 15
TabIndex = 3
Top = 720
Width = 2550
End
Begin VB.PictureBox Picture1
Align = 2 'Align Bottom
BorderStyle = 0 'None
Height = 840
Left = 0
ScaleHeight = 840
ScaleWidth = 4680
TabIndex = 0
Top = 1185
Width = 4680
Begin VB.CommandButton cmdAssoc
Caption = "Associate"
Height = 495
Left = 2640
TabIndex = 2
Top = 210
Width = 1215
End
Begin VB.CommandButton cmdBrowse
Caption = "Browse"
Height = 495
Left = 720
TabIndex = 1
Top = 210
Width = 1215
End
End
Begin VB.TextBox txtExt
Height = 345
Left = 1725
TabIndex = 6
Top = 45
Width = 780
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "Executable to launch associated extension:"
Height = 195
Left = 75
TabIndex = 4
Top = 465
Width = 3075
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "Extension to associate"
Height = 195
Left = 30
TabIndex = 5
Top = 105
Width = 1590
End
Attribute VB_Name = "frmMain"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
Caption = Caption & GetAppVer
End Sub
Private Sub cmdAssoc_Click()
Dim lngX As Long
Dim bGood As Boolean
Dim strX As String
If Len(txtFile) > 0 And Len(txtExt) > 0 Then
strX = LCase(Right(txtFile, 3))
If strX = "exe" Or strX = "com" Then
lngX = MsgBox("Continue?", vbYesNo, "Accociate " & _
txtExt & " files with " & ParseName(txtFile))
If lngX = vbYes Then
bGood = Associate(txtFile, txtExt)
If bGood Then
MsgBox "Successful", , "Association"
Else
MsgBox "FAILED", , "Association"
End If
End If
Else
MsgBox strX & " is not an executable", , "Error"
End If
Else
MsgBox "All fields are required", , "Error"
End If
End Sub
Private Sub cmdBrowse_Click()
Dim lngReturn As Long
Dim strFile As String
Dim FileDlg As New clsFileDialog
With FileDlg
.Filter = "Executable (*.exe)|*.exe|Commmand (*.com)|*.com"
.FilterIndex = 1
.Flags = cdlOFNHideReadOnly + cdlOFNFileMustExist
.WindowTitle = "Browse for executable"
strFile = .FileOpen
End With
If Len(strFile) > 0 Then txtFile = strFile
Set FileDlg = Nothing
End Sub
Private Sub Form_Resize()
With txtFile
.Move 0, Picture1.Top - .Height, ScaleWidth
End With
With Label1
.Move 0, txtFile.Top - .Height
End With
End Sub
Private Function GetAppVer() As String
With App
GetAppVer = " v" & .Major & "." & .Minor & " "
End With
End Function